package edu.wpi.first.wpilibj.util;

import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;

public class Line2D extends java.awt.geom.Line2D{
    
    java.awt.geom.Point2D p1, p2;

    public Line2D(java.awt.geom.Point2D start, java.awt.geom.Point2D end) {
        p1 = start;
        p2 = end;
    }
    
    public Line2D (double x1, double y1, double x2, double y2){
        this (new Point2D(x1, y1), new Point2D(x2, y2));
    }

    @Override
    public java.awt.geom.Point2D getP1() {
        return p1;
    }

    @Override
    public java.awt.geom.Point2D getP2() {
        return p2;
    }

    @Override
    public double getX1() {
        return p1.getX();
    }

    @Override
    public double getX2() {
        return p2.getX();
    }

    @Override
    public double getY1() {
        return p1.getY();
    }

    @Override
    public double getY2() {
        return p2.getY();
    }

    @Override
    public void setLine(double x1, double y1, double x2, double y2) {
        p1 = new Point2D (x1, y1);
        p2 = new Point2D (x2, y2);
    }

    @Override
    public Rectangle2D getBounds2D() {
        return new Rectangle ((int) p1.getX(),(int) p1.getY(),(int) (p2.getX() - p1.getX()),(int) (p2.getY() - p1.getY()));
    }
    
    
}
